/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.web.mapper;

import com.jeeplus.core.persistence.BaseMapper;
import com.jeeplus.core.persistence.annotation.MyBatisMapper;
import com.jeeplus.modules.web.entity.WxUser;
import com.jeeplus.modules.web.entity.WxUserCoupon;
import com.jeeplus.modules.web.entity.wx.YsUser;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 用户MAPPER接口
 * @author rongjie
 * @version 2017-08-06
 */
@MyBatisMapper
public interface WxUserMapper extends BaseMapper<WxUser> {

    /**
     * 是否注册
     * @param openid
     * @return
     */
    @Select("select count(1) from wx_user where openid=#{openid}")
    int getUserCount(String openid);

    /**
     * 注册
     * @param wxUserInfo
     * @return
     */
    Integer addUser(YsUser wxUserInfo);

    YsUser getWxUserInfo(String openid);

    void set(YsUser wxUserInfo);

    /**
     *
     * @param id
     * @return
     */
    List<WxUserCoupon> getUserCouponList(String id);

    int setCoupon(@Param("id") String id, @Param("coupon") String coupon);

    double getCoMoney(String id);
}